# Maintainer: Dekedro <dekedro@protonmail.com>
pkgname=espeak-ng
pkgver=1.51.1
pkgrel=1
pkgdesc="Multi-lingual software speech synthesizer"
url="https://github.com/espeak-ng/espeak-ng"
arch="all !s390x" # Tests fail on s390x
license="GPL-3.0-or-later"
makedepends="autoconf automake libtool pcaudiolib-dev ronn"
checkdepends="grep python3 sox"
subpackages="$pkgname-dev $pkgname-doc $pkgname-vim::noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/espeak-ng/espeak-ng/archive/refs/tags/$pkgver.tar.gz
	fix-grep-tests.patch
	remove-bom.patch
	disable-failing-tests.patch
	fix-incorrect-breath-usage.patch
	use-larger-buf.patch
	robust-computation.patch
	"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make -j1 check
}

package() {
	make DESTDIR="$pkgdir" install
}

vim() {
	pkgdesc="$pkgdesc (vim syntax)"
	install_if="$pkgname=$pkgver-r$pkgrel vim"

	amove /usr/share/vim
}

sha512sums="
291958c2d3a1e38f9006416347d40d98be7afc84057475c9394788610897d19c02fabc32ebb8efa6dac291d106f97bf63907d0688ef7d93ea24439cba22392d1  espeak-ng-1.51.1.tar.gz
41e672b4ab30893f983bec5f5e46b81a2c25baecfffc3d46e72717896948225fc49e99a553f9d0ba5a544308066301abb43f77093054e5aeb0b50b4af007d320  fix-grep-tests.patch
d88f3d51d306f2e315bd2d8c3479084bc5f3f64ba97c24dff5c3afadba20ac09d7ebba15bc30b7cb5edc0fb443995d65ac2390b22347a7e4385b4b923a4f9c3d  remove-bom.patch
d95b96911e9ecda7d70a9aed614147b0cefee1ea10eac7183e685e83d68b8e73740e20f1ed774be939e87f42feaa3555709b876242c20f8a74fa6e812b735e2d  disable-failing-tests.patch
f5983e5d9493b2bdb9793bc94660ca7691717c74ac0e1f5499678d51e21523894a3ba16fe3836a034cd9ac6608742837247af3297ed7df2296e5ab2a8e13c042  fix-incorrect-breath-usage.patch
54cdcb8d60f1b1bf33eb1c3d9a08bcdcdeb80366c85a1c9fc07c0f034ceb4f02724756d89668ebd7ded3746968aa9fae8bdc983464384c2d555feff07f0546d0  use-larger-buf.patch
ef3fd65c5eadcb9751f3f7afe516c6d15aa313259761993c706430653078d72f493e98ed5b6c74bca62bc7e311e075171bebf3375c79d2679c309bab4537c88d  robust-computation.patch
"
